/** bcmi_frame Stream sender definition.
 *
 *  bcmi_frame Stream sender definition.
 *
 *  @author : huicong
 *  @date : 2008-10-27
 *
 */

#ifndef _STREAM_SENDER_H
#define _STREAM_SENDER_H

#include "BasicHeader.h"
#include "BCMI_Frame.h"

namespace bcmi_frame
{

    /**
     *
     * //UNDO
     *
     */
    VIRTUAL_CLASS class StreamSender
    {
    public:

        StreamSender():
          _maxPoolSize(bcmi_frame::DEFAULT_MAX_POOL_SIZE),
              _maxPoolNumber(bcmi_frame::DEFAULT_MAX_POOL_NUMBER),
              _bufferPool(NULL),
              _poolNumber(0),
              _poolId(-1),
              _poolPtr(-1)
          {
          }

          virtual ~StreamSender()
          {
          }


    public:

        /** Put buffer pool method.
         *
         *  Put buffer pool method. 
         *  You can put the buffer pool to anywhere : remote process or file.
         *
         *  @return HRESULT : running result.
         *
         */
        virtual HRESULT putBufferPool() = 0;

    public:

        /** Reset the max pool size.
        *
        *  @param [IN] UINT _number : new max size of pool.
        *
        */
        void setMaxPoolSize(IN UINT _size)
        {
            _maxPoolSize = _size;
        }

        /** Reset the max pool number.
        *
        *  @param [IN] UINT _number : new max number of pool.
        *
        */
        void setMaxPoolNumber(IN UINT _number)
        {
            _maxPoolNumber = _number;
        }

        /** return max pool size */
        UINT getMaxPoolSize()
        {
            return _maxPoolSize;
        }

        /** return max pool number */
        UINT getMaxPoolNumber()
        {
            return _maxPoolNumber;
        }

    protected:

        BYTE **_bufferPool;
        /** at _poolId buffer pool(<_poolNumber<_maxPoolNumber) and now point _poolPtr(<_maxPoolSize) */
        UINT _poolId, _poolPtr; // current pointer
        UINT _poolNumber; // current number of pool

        UINT _maxPoolSize; // the max byte in one pool
        UINT _maxPoolNumber; // the max number of pool
    };

};//namespace bcmi_frame



#endif //#ifndef _STREAM_SENDER_H